#include "stdafx.h"
#include "ResHack.h"
using namespace std;

static const vector<BYTE> TH18a_SIGN = {
	0x68, 0xD0, 0xC6, 0x4A, 0x00, 0xE8, 0xE1, 0xCE, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xE0, 0xC6, 0x4A, 0x00, 0xE8, 0xD1, 0xCE, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xF0, 0xC6, 0x4A, 0x00, 0xE8, 0xC1, 0xCE, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x00, 0xC7, 0x4A, 0x00, 0xE8, 0xB1, 0xCE, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH18a_SIGN, ResHackFastcall, 0x402060, 0x49D022);

static const vector<BYTE> TH17b_SIGN = {
	0x68, 0xF0, 0x9D, 0x49, 0x00, 0xE8, 0xC0, 0xA4, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x00, 0x9E, 0x49, 0x00, 0xE8, 0xB0, 0xA4, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x10, 0x9E, 0x49, 0x00, 0xE8, 0xA0, 0xA4, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x20, 0x9E, 0x49, 0x00, 0xE8, 0x90, 0xA4, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH17b_SIGN, ResHackFastcall, 0x4020D0, 0x47EF94);

static const vector<BYTE> TH17a_SIGN = {
	0x68, 0xA0, 0xAC, 0x49, 0x00, 0xE8, 0x70, 0xB3, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xB0, 0xAC, 0x49, 0x00, 0xE8, 0x60, 0xB3, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xC0, 0xAC, 0x49, 0x00, 0xE8, 0x50, 0xB3, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xD0, 0xAC, 0x49, 0x00, 0xE8, 0x40, 0xB3, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH17a_SIGN, ResHackFastcall, 0x4020D0, 0x47FE44);

static const vector<BYTE> TH17tr_SIGN = {
	0x68, 0xD0, 0x6E, 0x49, 0x00, 0xE8, 0xC0, 0xAA, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xE0, 0x6E, 0x49, 0x00, 0xE8, 0xB0, 0xAA, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0xF0, 0x6E, 0x49, 0x00, 0xE8, 0xA0, 0xAA, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x00, 0x6F, 0x49, 0x00, 0xE8, 0x90, 0xAA, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH17tr_SIGN, ResHackFastcall, 0x401FB0, 0x47F4A4);

static const vector<BYTE> TH16_5_SIGN = {
	0x68, 0x30, 0x53, 0x49, 0x00, 0xE8, 0x41, 0x9A, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x40, 0x53, 0x49, 0x00, 0xE8, 0x31, 0x9A, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x50, 0x53, 0x49, 0x00, 0xE8, 0x21, 0x9A, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x60, 0x53, 0x49, 0x00, 0xE8, 0x11, 0x9A, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH16_5_SIGN, ResHackFastcall, 0x401FC0, 0x486A29);

static const vector<BYTE> TH16_SIGN = {
	0x68, 0x10, 0xAC, 0x48, 0x00, 0xE8, 0x66, 0x3C, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x20, 0xAC, 0x48, 0x00, 0xE8, 0x56, 0x3C, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x30, 0xAC, 0x48, 0x00, 0xE8, 0x46, 0x3C, 0x07, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x56, 0x57, 0x6A, 0x68, 0x6A, 0x00, 0x68, 0xA0, 0x12, 0x4C, 0x00, 0xE8, 0xE0, 0x68, 0x07, 0x00
};
REGISTER_RES_HACK(0x401000, TH16_SIGN, ResHackFastcall, 0x402440, 0x477FA7);

static const vector<BYTE> TH15_SIGN = {
	0x68, 0xF0, 0xD7, 0x4B, 0x00, 0xE8, 0x1D, 0xF6, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x00, 0xD8, 0x4B, 0x00, 0xE8, 0x0D, 0xF6, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0x68, 0x10, 0xD8, 0x4B, 0x00, 0xE8, 0xFD, 0xF5, 0x08, 0x00, 0x59, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC,
	0xF3, 0x0F, 0x6F, 0x05, 0x44, 0x6F, 0x4E, 0x00, 0xA1, 0x54, 0x6F, 0x4E, 0x00, 0x81, 0x0D, 0xCC
};
REGISTER_RES_HACK(0x401000, TH15_SIGN, ResHackFastcall, 0x402DB0, 0x490432);

static const vector<BYTE> TH14_SIGN = {
	0x83, 0x61, 0x04, 0xFE, 0xC7, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x41, 0x0C, 0x00, 0x00,
	0x00, 0x00, 0xC7, 0x41, 0x10, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x89,
	0x49, 0x14, 0xC7, 0x41, 0x18, 0x00, 0x00, 0x00, 0x00, 0xC7, 0x41, 0x1C, 0x00, 0x00, 0x00, 0x00,
	0xC7, 0x41, 0x20, 0x00, 0x00, 0x00, 0x00, 0x8B, 0xC1, 0xC3, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC
};
REGISTER_RES_HACK(0x401000, TH14_SIGN, ResHackFastcall, 0x402B00, 0x485540);

static const vector<BYTE> TH13_SIGN = {
	0x55, 0x8B, 0xEC, 0x51, 0x53, 0x56, 0x57, 0x6A, 0x78, 0x8B, 0xDA, 0x8B, 0xF9, 0xE8, 0xDB, 0x90,
	0x07, 0x00, 0x6A, 0x78, 0x8B, 0xF0, 0x6A, 0x00, 0x56, 0x89, 0xB7, 0x8C, 0x05, 0x00, 0x00, 0xE8,
	0x0C, 0x23, 0x08, 0x00, 0xD9, 0x03, 0xD9, 0x1E, 0x83, 0xC4, 0x10, 0xD9, 0x43, 0x04, 0xB9, 0x1C,
	0xC3, 0x4D, 0x00, 0xD9, 0x5E, 0x04, 0xD9, 0x06, 0xDC, 0x05, 0xF0, 0xE9, 0x4A, 0x00, 0xD9, 0x1E
};
REGISTER_RES_HACK(0x401000, TH13_SIGN, ResHackStdcall, 0x4724C0, 0x47A0ED);

static const vector<BYTE> TH12_SIGN = {
	0x8D, 0x4E, 0x14, 0xC7, 0x06, 0xB8, 0xF4, 0x49, 0x00, 0xE8, 0xD2, 0x17, 0x00, 0x00, 0x8D, 0x8E,
	0xC8, 0x04, 0x00, 0x00, 0xE8, 0xC7, 0x17, 0x00, 0x00, 0x68, 0xC4, 0x8F, 0x01, 0x00, 0x6A, 0x00,
	0x56, 0xE8, 0xFA, 0x63, 0x07, 0x00, 0xD9, 0xE8, 0x83, 0x4E, 0x04, 0x02, 0xD9, 0x96, 0x84, 0x8F,
	0x01, 0x00, 0xB8, 0x01, 0x00, 0x00, 0x00, 0xD9, 0x9E, 0x88, 0x8F, 0x01, 0x00, 0x89, 0x86, 0xA4
};
REGISTER_RES_HACK(0x401000, TH12_SIGN, ResHackFirstArgAtEax, 0x463C10, 0x46D04A);

static const vector<BYTE> TH11_SIGN = {
	0x8D, 0x4E, 0x14, 0xC7, 0x06, 0xC8, 0x38, 0x49, 0x00, 0xE8, 0x62, 0x12, 0x00, 0x00, 0x8D, 0x8E,
	0x48, 0x04, 0x00, 0x00, 0xE8, 0x57, 0x12, 0x00, 0x00, 0x68, 0xBC, 0x84, 0x01, 0x00, 0x6A, 0x00,
	0x56, 0xE8, 0xFA, 0x96, 0x06, 0x00, 0xD9, 0xE8, 0x83, 0x4E, 0x04, 0x02, 0xD9, 0x96, 0x84, 0x84,
	0x01, 0x00, 0xD9, 0x9E, 0x88, 0x84, 0x01, 0x00, 0x83, 0xC4, 0x0C, 0x89, 0x35, 0x58, 0x8D, 0x4A
};
REGISTER_RES_HACK(0x401000, TH11_SIGN, ResHackFirstArgAtEax, 0x458400, 0x460192);

static const vector<BYTE> TH10_SIGN = {
	0xC7, 0x06, 0x14, 0xCB, 0x46, 0x00, 0x8B, 0x86, 0x80, 0x00, 0x00, 0x00, 0x8D, 0x56, 0x14, 0x53,
	0xBB, 0xFE, 0xFF, 0xFF, 0xFF, 0x57, 0x23, 0xC3, 0x89, 0x42, 0x6C, 0x21, 0x9A, 0xB0, 0x00, 0x00,
	0x00, 0x21, 0x9A, 0xFC, 0x00, 0x00, 0x00, 0x21, 0x9A, 0x28, 0x01, 0x00, 0x00, 0x21, 0x9A, 0x74,
	0x01, 0x00, 0x00, 0x21, 0x9A, 0xB0, 0x01, 0x00, 0x00, 0x21, 0x9A, 0xFC, 0x01, 0x00, 0x00, 0x21
};
REGISTER_RES_HACK(0x401000, TH10_SIGN, ResHackFirstArgAtEax, 0x44B360, 0x452706);

static const vector<BYTE> TH09_SIGN = {
	0x55, 0x8B, 0xEC, 0xD9, 0x45, 0x18, 0xDC, 0xC0, 0xD9, 0x45, 0x18, 0xD8, 0x25, 0xA4, 0x92, 0x48,
	0x00, 0xD9, 0x05, 0xA4, 0x92, 0x48, 0x00, 0xD8, 0x65, 0x18, 0xD9, 0x05, 0xA0, 0x92, 0x48, 0x00,
	0xD8, 0xE3, 0xD8, 0x4D, 0x18, 0xD8, 0x4D, 0x18, 0xD8, 0x4D, 0x0C, 0xD9, 0xCB, 0xD8, 0x05, 0xA4,
	0x92, 0x48, 0x00, 0xD8, 0xCA, 0xD8, 0xCA, 0xD8, 0x4D, 0x08, 0xDE, 0xC3, 0xD9, 0xC0, 0xD8, 0xC9
};
REGISTER_RES_HACK(0x401000, TH09_SIGN, ResHackFastcall, 0x42C1C0, 0x479015);

static const vector<BYTE> TH08_SIGN = {
	0x55, 0x8B, 0xEC, 0x51, 0x89, 0x4D, 0xFC, 0x8B, 0x4D, 0xFC, 0xE8, 0x11, 0x47, 0x00, 0x00, 0x8B,
	0x4D, 0xFC, 0x81, 0xC1, 0xA4, 0x02, 0x00, 0x00, 0xE8, 0x03, 0x47, 0x00, 0x00, 0x8B, 0x4D, 0xFC,
	0x81, 0xC1, 0x48, 0x05, 0x00, 0x00, 0xE8, 0xF5, 0x46, 0x00, 0x00, 0x8B, 0x4D, 0xFC, 0x81, 0xC1,
	0xEC, 0x07, 0x00, 0x00, 0xE8, 0xE7, 0x46, 0x00, 0x00, 0x8B, 0x4D, 0xFC, 0x81, 0xC1, 0x90, 0x0A
};
REGISTER_RES_HACK(0x402000, TH08_SIGN, ResHackFastcall, 0x43E660, 0x4A4269);

static const vector<BYTE> TH07_SIGN = {
	0x55, 0x8B, 0xEC, 0x51, 0x89, 0x4D, 0xFC, 0x8B, 0x45, 0xFC, 0xC7, 0x40, 0x38, 0x00, 0x00, 0x00,
	0x00, 0x8B, 0x4D, 0xFC, 0xC7, 0x41, 0x34, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x55, 0xFC, 0xC7, 0x42,
	0x30, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x45, 0xFC, 0xC7, 0x40, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x8B,
	0x4D, 0xFC, 0xC7, 0x41, 0x24, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x55, 0xFC, 0xC7, 0x42, 0x20, 0x00
};
REGISTER_RES_HACK(0x401000, TH07_SIGN, ResHackTH07, 0x431330, 0x47D39D, 0x4B9E64);

static const vector<BYTE> TH06_SIGN = {
	0x55, 0x8B, 0xEC, 0x81, 0xEC, 0x88, 0x00, 0x00, 0x00, 0x89, 0x8D, 0x78, 0xFF, 0xFF, 0xFF, 0x8B,
	0x8D, 0x78, 0xFF, 0xFF, 0xFF, 0xE8, 0x06, 0x27, 0x00, 0x00, 0x8B, 0x8D, 0x78, 0xFF, 0xFF, 0xFF,
	0x81, 0xC1, 0x10, 0x01, 0x00, 0x00, 0xE8, 0xF5, 0x26, 0x00, 0x00, 0xC7, 0x45, 0xDC, 0x00, 0x01,
	0x00, 0x00, 0xC7, 0x45, 0xD8, 0x60, 0x00, 0x00, 0x00, 0x8B, 0x85, 0x78, 0xFF, 0xFF, 0xFF, 0x05
};
REGISTER_RES_HACK(0x401000, TH06_SIGN, ResHackTH06, 0x41DE30, 0x45BB99, 0x69D780);
